<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
	<meta content="yes" name="apple-mobile-web-app-capable">
	<meta content="black" name="apple-mobile-web-app-status-bar-style">
	<title>审批意见</title>
    <script src="/Public/Home/js/zepto.min.js"></script>
    <link href="/Public/Home/css/weui.min.css" rel="stylesheet">
	<link rel="stylesheet" href="/Public/Home/SaleManager/stylesheets/index.css">
</head>
<body>
	<div class="approveOpion">
    <header class = "all_header">
      <a class = "h_back h_back_1" href="javascript:void(0)"><img src="/Public/Home/SaleManager/images/back_icon.png" alt=""></a>
      <span class = "h_title">审批意见</span>
      <a class = "h_add" href="javascript:void(0)"></a>
    </header>
		<div class="weui-panel__bd">
      <a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg">
        <div class="weui-media-box__hd">
          <img class="weui-media-box__thumb" src="/Public/Home/SaleManager/images/people.png" alt="">
        </div>
        <div class="weui-media-box__bd">
          <h4 class="weui-media-box__title"><?php echo ($appinfo["apply_name"]); ?></h4>
          <p class="weui-media-box__desc"><?php echo (date('Y-m-d H:i:s',$appinfo["reply_time"])); ?></p>
        </div>
        <div class="next_approval"><span><?php echo ($appinfo["apply_cstatus"]); ?></span></div>
      </a>
    </div>
    <div class="approve_opion_w">
    	<div class="weui-panel__hd"><?php echo ($appinfo["ctype"]); ?></div>
    	<div class = "approval_cont"><?php echo ($appinfo["apply_content"]); ?></div>	
    	<div class="weui-panel__hd">选择交接人</div>
    	<div class="weui-cell weui-cell_select" style = "padding: 0 15px;border:1px solid #d9d9d9;">
        <div class="weui-cell__bd">
          <select class="weui-select" name="select1" id='change_user'>
          <?php if(is_array($lists)): $i = 0; $__LIST__ = $lists;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><option value="<?php echo ($v["id"]); ?>"><?php echo ($v["real_name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
          </select>
        </div>
      </div>
    </div>
    <div class="js_dialog" id="confirm_dialog" style="display: none;">
      <div class="weui-mask"></div>
      <div class="weui-dialog">
        <div class="weui-dialog__bd"></div>
        <div class="weui-dialog__ft">
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary">确 定</a>
        </div>
      </div>
    </div>
    <div class="js_dialog" id="iosDialog1" style="display: none;">
    <div class="weui-mask"></div>
    <div class="weui-dialog">
        <div class="weui-dialog__hd"><strong class="weui-dialog__title">提示</strong></div>
        <div class="weui-dialog__bd confir_content"></div>
        <div class="weui-dialog__ft">
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_default cancel-btn">取消</a>
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary ok-btn">确定</a>
        </div>
    </div>
</div>
 <div class="js_dialog" id="jsconfiroms" style="display: none;">
    <div class="weui-mask"></div>
    <div class="weui-dialog">
        <div class="weui-dialog__hd"><strong class="weui-dialog__title">提示</strong></div>
        <div class="weui-dialog__bd confir_content"></div>
        <div class="weui-dialog__ft">
            
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary oksss-btn">确定</a>
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_default cancelsss-btn">取消</a>
        </div>
    </div>
</div>


  <script type="text/javascript">
	var saleManagerStatus; //操作返回状态
	$(document).ready(function() { 
		saleManagerStatus='';
		saleManagerStatus ='<?php echo ($status); ?>';  //success,成功；error,错误
		msg ='<?php echo ($msg); ?>';
		if(saleManagerStatus=='success'||saleManagerStatus=='validatefail'){
			$('.weui-dialog__bd').html(msg);
     		$('#confirm_dialog').css('display','block');
     		//saleManagerStatus='formSubmitTrue';
		}
		if(saleManagerStatus=='error'){ 
			$('.weui-dialog__bd').html(msg);
     		$('#confirm_dialog').css('display','block');
     		//saleManagerStatus='formSubmitTrue';
		}
	}); 
	//关闭弹出框
	$(document).on('click','.weui-dialog__btn_primary',function(){
		$('#confirm_dialog').css('display','none');
		if(saleManagerStatus=='error'){
			history.go(-1);
		}
	}); 
	
	$(document).on('click','.cancelsss-btn',function(){
		$('#jsconfiroms').css('display','none');
	});
  </script>
    <?php if(($appinfo["saleman_ids"] != $myself.id) AND $appinfo["apply_cstatus"] != '已通过'): if($myself["role_id"] == 7): else: ?><div class="approval_btn_w">
	    	<a href="javascript:;" class="weui-btn weui-btn_primary changesaleman" data-apply-userid='<?php echo ($appinfo["saleman_ids"]); ?>' data-apply-id='<?php echo ($appinfo["ids"]); ?>' data-status='1'>同意</a>
	    	<a href="javascript:;" class="weui-btn weui-btn_warn changesaleman" data-apply-userid='<?php echo ($appinfo["saleman_ids"]); ?>' data-apply-id='<?php echo ($appinfo["ids"]); ?>' data-status='2'>不同意</a>
	    </div><?php endif; endif; ?>
	</div>
</body>
<script src = "/Public/Home/SaleManager/js/androidback.js"></script>
<script type="text/javascript">
var sessioncode;
var nosesstion_url;
$(document).on("click",".changesaleman",function(){
	
	$.ajax({
        url: "/Home/SaleManager/County/approveOpinion",
        type: 'POST',
        data: {'reply_status':$(this).attr('data-status'),'applyId':$(this).attr('data-apply-id'),'origin_user':$(this).attr('data-apply-userid'),'change_apply':$('#change_user').val()},
        async: false,
        cache: false,
       	dataType:"json",
        success: function (returndata) {
       	 	//session失效
       	 	if(returndata.code==2028){
       	 		sessioncode=2028;
       	 		nosesstion_url=returndata.data;
	       	 	$('.weui-dialog__bd').html(returndata.msg);
	     		$('#confirm_dialog').css('display','block');
       	 	}else{
	       	 	$('.weui-dialog__bd').html(returndata.msg);
	     		$('#confirm_dialog').css('display','block');
       	 	}
        		
        },
        error: function (returndata) {
        		$('.weui-dialog__bd').html(returndata.msg);
     		$('#confirm_dialog').css('display','block');
        }
    });
})

$(document).on('click','.weui-dialog__btn_primary',function(){
	if(sessioncode==2028){
		window.location.href=nosesstion_url;
	}else{
		window.location.href='../../approvalRecord.html';
	}
	
})

$(document).on('click','.h_back',function(){
	location.href=document.referrer;
})
</script>
</html>